function get_content(url_read, url_write, domain_used, biov_domain, id){	
	var q  = '{"query":[{"name":null,'+
						'"guid":null,'+
						'"id":"'+id+'",'+
						'"type":"'+biov_domain+'bv_therapeutic",'+
						'"biomolecule_or_target":[{"*":null,"optional":true}],'+
						'"'+biov_domain+'product/developed_by":[{"*":null,"optional":true}],'+
						'"'+biov_domain+'product/sales":[{"*":null,"optional":true}],'+
						'"indication_or_disease":[{"*":null,"optional":true, "disease":{"name":null, "id":null,"optional":true}}]'+
						'}]}';
	
	perform_freebase_read(
		url_read,
		q,
		function (msg) {
			var therapeutic = null;
			therapeutic = msg.result[0];
	        if (!therapeutic) return;
			
			var therapeutic_info = Object();

	        //name
	        var name = therapeutic.name;
	        $('#title').text(name);
	        therapeutic_info.topic_name = name;

			// IDs
			therapeutic_info.guid = therapeutic.guid;
			therapeutic_info.id = therapeutic.guid;
			
			// Get the overview blurb
			var topic_domain = biov_domain+'bv_therapeutic';
			jsonp_totalblurb_freebase(domain_used, name, topic_domain, 500,
					function(m){
						$("#thumb").attr('src','http://'+domain_used+'/api/trans/image_thumb'+m.result[0].image.id);
					},
					function(m){
						$("#description").append($('<span>'+m.result.body+'</span>'));
					},
					function(m){}
				);
			
	       	var overviewData = new google.visualization.DataTable();
    		overviewData.addColumn('string', '');
    		overviewData.addColumn('string', '');
 			overviewData.addRows(2);    		
		 	var dTable = new google.visualization.Table(document.getElementById('overview_table'));      			
    	
    		// Therapeutic developers:	
			var h = '';
			for (var i in therapeutic[biov_domain+"product/developed_by"]){
				var company = therapeutic[biov_domain+"product/developed_by"][i];
				h += '<a href="'+create_bvr_topic_href('company', company.id)+'">' + company.name + '</a>'
				h += ( i < therapeutic[biov_domain+"product/developed_by"].length-1 ? ', ' :"");
			}
			therapeutic_info.developed_by = therapeutic[biov_domain+"product/developed_by"];
			overviewData.setCell(0, 0, '<b>Developed By</b>');
			overviewData.setCell(0, 1, h);

			// Therapeutic target:
			therapeutic_info.target = therapeutic.biomolecule_or_target;
      		var h2 = ''
			for (var i in therapeutic.biomolecule_or_target) {
				var target = therapeutic.biomolecule_or_target[i];
				h2 += '<a href="'+create_bvr_topic_href('biomolecule', target.id)+'">' + target.name + '</a>'
				h2 += ( i < therapeutic.biomolecule_or_target.length-1 ? ', ' :"");
			}
			overviewData.setCell(1, 0, '<b>Target</b>');
			overviewData.setCell(1, 1, h2);
			dTable.draw(overviewData, {allowHtml: true});
			
			// Product sales:
			create_sales_table(therapeutic[biov_domain+"product/sales"]);
			
			// Indications:
			create_indication_table(therapeutic.indication_or_disease, topic_domain, domain_used, biov_domain);
			
			// Create the edit form:
			create_edit_form(url_read, url_write, domain_used, biov_domain, therapeutic_info, name);
								
		},
		function(m){}
	);
}

function create_sales_table(sales){

	if(sales.length > 0) {
		var numSales = sales.length;
		var salesData = new google.visualization.DataTable();
		salesData.addColumn('number', 'Amount ($M)');
		salesData.addColumn('string', 'Year');
		salesData.addColumn('string', 'Area');
		salesData.addColumn('string', 'Company Reporting');
 		salesData.addRows(numSales);
  		var dTable = new google.visualization.Table(document.getElementById('sales'));      			
		for (var i in sales) {
			var amount = sales[i].amount/1000000;
			var year = sales[i].year;
			var area = sales[i].area;
			var company = sales[i].company_reporting;
			
			salesData.setCell(parseFloat(i), 0, amount);
			salesData.setCell(parseFloat(i), 1, year);
			salesData.setCell(parseFloat(i), 2, area);
			salesData.setCell(parseFloat(i), 3, company);
					
		}
		dTable.draw(salesData, {allowHtml: true, sortColumn: 1, sortAscending: false});
	}
}
function create_indication_table(indications, topic_domain, domain_used, biov_domain){	

	if(indications.length > 0) {
			
		var numInds = indications.length;
		var indData = new google.visualization.DataTable();
		indData.addColumn('string', 'Disease');
		indData.addColumn('string', 'Phase of Development');
		//indData.addColumn('string', 'Overview');
	    //indData.addColumn('string', '');
	 	indData.addRows(numInds);
  		var dTable = new google.visualization.Table(document.getElementById('indications_div'));      			
  		var verboses = Array(numInds);
 		for (var i=0;i<numInds;i=i+1) {	 	
 			verboses[i] = false;
 		}
		var view = new google.visualization.DataView(indData);
  		view.setColumns([0,1]); 
  		var topic_domain = biov_domain+'bv_medical_condition';
	      		
		for (var j in indications) {
			var disease = indications[j].disease;
			var diseaseLink = '<a href="'+create_bvr_topic_href('disease',disease.id)+ '">' + disease.name + '</a>';
			var phase = indications[j].phase_of_development;
					
			indData.setCell(parseFloat(j), 0, diseaseLink);
			indData.setCell(parseFloat(j), 1, phase);
			//x(j,2,3,indData,view, disease.name, topic_domain, domain_used,  dTable, 500, 100);
//			x(pMarketI,7,8,pMarketData, marketView, productName, topic_domain, domain_used,  marketTable, 500,150);
			dTable.draw(view, {allowHtml: true});	
//					 	google.visualization.events.addListener(dTable, 'select', function() {
//				 			verboses = setSelectionExpander2(indData, dTable, view, verboses, 2, 3);
//						});
													
		}
		dTable.draw(indData, {allowHtml: true});
	}
}
